﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CarbonMeter
{
    public partial class MainForm : Form
    {
        public static User user;
        private static MyTabs myTabs;
        private static LicenseEventArg arg;

        public MainForm(User user)
        {
            // TODO: Complete member initialization
            MainForm.user = user;
            InitializeComponent();
            this.Text += "-" + user.name + " " + user.surname; 
            
        }

        //TODO: gelen tab bilgisine göre hangi tablarin aktif olacagi ayarlanmali
        public MainForm(User user, MyTabs myTabs, LicenseEventArg arg)
        {
            // TODO: Complete member initialization
            MainForm.user = user;
            MainForm.myTabs = myTabs;
            MainForm.arg = arg;
            InitializeComponent();
            this.Text += "-" + user.name + " " + user.surname; 
        }
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                Database.getInstance().Close();
                Application.Exit();
            }
            catch (Exception)
            {
                
                
            }
        }
        FossilFuelConsumptionForm fossilFuelConsumptionForm = null;
        private void fosilYakıtGirdileriToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (fossilFuelConsumptionForm == null || fossilFuelConsumptionForm.IsDisposed)
                fossilFuelConsumptionForm = new FossilFuelConsumptionForm();
            else
                return;
            fossilFuelConsumptionForm.MdiParent = this;
            fossilFuelConsumptionForm.Show();
        }

        private void hakkındaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //new AboutBoxS().ShowDialog(this);
            new AboutForm(arg).ShowDialog(this);
        }

        private void raporlamaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
        }

        private void yönetimToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
        }
        PeopleTransportationConsumptionForm peopleTrans = null;
        private void insanTaşımacılığıToolStripMenuItem_Click(object sender, EventArgs e)
        {
            peopleTrans = new PeopleTransportationConsumptionForm();
            peopleTrans.MdiParent = this;
            peopleTrans.Show();
        }
        ReportForm report = null;
        private void yıllıkCarbonDağılımıToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (report == null || report.IsDisposed)
                report = new ReportForm();
            else
                return;
            report.MdiParent = this;
            report.Show();
        }

        NakliyeTuketimleri nakliye = null;

        private void nakliyeTaşımacılığıToolStripMenuItem_Click(object sender, EventArgs e)
        {
             if (nakliye == null || nakliye.IsDisposed)
                nakliye = new NakliyeTuketimleri();
            else
                return;
            nakliye.MdiParent = this;
            nakliye.Show();
        }

        internal void SetLicense(MyTabs myTabs, LicenseEventArg arg)
        {
            throw new NotImplementedException();
        }
    }
}
